package com.vast.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 演示实体父类
 */
@Data
@NoArgsConstructor
public class SuperEntity {

    /**
     * 主键ID , 这里故意演示注解可以无
	 * 序号
	 */
	@TableId(value = "id", type = IdType.AUTO)
	@ApiModelProperty(value="序号")
    public Long id;


    /**
     * 创建者
     */
    @ApiModelProperty(value = "创建人")
    @TableField(value = "create_by")
    public Long createBy;

    /**
     * 创建者
     */
    @ApiModelProperty(value = "创建人")
    @TableField(exist = false)
    public String creator;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    @ApiModelProperty(value = "创建时间")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date createTime;

    /**
     * 更新者
     */
    @TableField(value = "update_by")
    @ApiModelProperty(value = "更新者")
    public Long updateBy;

    /**
     * 更新者
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "更新者")
    public String updater;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
    public Date updateTime;

    /**
     * 逻辑删除 0-删除, 默认-1
     */
    @TableField(value = "valid")
    @ApiModelProperty(value = "逻辑删除 0-删除, 默认-1")
    @TableLogic
    public Integer valid;

    /** 请求参数 */
    @TableField(exist = false)
    private Map<String, Object> params  = new HashMap<>();


    /** 开始时间 */
    @JsonIgnore
    @TableField(exist = false)
    private String beginTime;

    /** 结束时间 */
    @JsonIgnore
    @TableField(exist = false)
    private String endTime;


	public static final String COL_ID = "id";

	public static final String COL_CREATE_BY = "create_by";

	public static final String COL_CREATE_TIME = "create_time";

	public static final String COL_UPDATE_BY = "update_by";

	public static final String COL_UPDATE_TIME = "update_time";

	public static final String COL_VALID = "valid";


//    public Map<String, Object> getParams()
//    {
//        if (params == null)
//        {
//            params = new HashMap<>();
//        }
//        return params;
//    }
//
//    public void setParams(Map<String, Object> params)
//    {
//        this.params = params;
//    }


}
